import { legacy_createStore as createStore, applyMiddleware } from 'redux'

import thunk from 'redux-thunk'
import { composeWithDevTools } from 'redux-devtools-extension'
import { RootReducers } from './reducers'
import { getToken } from '@/utils/token'

const middleware = composeWithDevTools(applyMiddleware(thunk))

const InitialState = {
  login: getToken(),
}

const store = createStore(RootReducers, InitialState, middleware)

export default store
